﻿@using Abp.Web.Mvc.Extensions
@using AbpLearningDemo.Companies.Dto
@using AbpLearningDemo.DataModels
@model AbpLearningDemo.Web.Models.Companies.CompanyListViewModel
@{
    ViewBag.ActiveMenu = PageNames.Companies; //The menu item will be active for this page.
}
@section scripts
{
    @Html.IncludeScript("~/Views/Companies/Index.js")
}
<div class="row clearfix">
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div class="card">
            <div class="header">
                <h2>
                    企业管理 @*@L("Companies")*@
                </h2>
                <ul class="header-dropdown m-r--5">
                    <li class="dropdown">
                        <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                            <i class="material-icons">more_vert</i>
                        </a>
                        <ul class="dropdown-menu pull-right">
                            <li><a id="RefreshButton" href="javascript:void(0);" class="waves-effect waves-block"><i class="material-icons">refresh</i>刷新</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div class="body table-responsive">
                <table class="table">
                    <thead>
                        <tr>
                            <th>企业名称</th>
                            <th>企业电话</th>
                            <th>企业地址</th>
                            @*<th>企业简介</th>*@
                            <th>启用</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (CompanyListDto company in Model.Companies)
                        {
                            <tr>
                                <td>@company.Name</td>
                                <td>@company.Phone</td>
                                <td>@company.Address</td>
                                @*<td>@company.Introduction</td>*@
                                <td><i class="material-icons" style="color:@(company.IsActive ? "green":"red");">@(company.IsActive ? "check_box" : "indeterminate_check_box")</i></td>
                                <td class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                        <i class="material-icons">menu</i>
                                    </a>
                                    <ul class="dropdown-menu pull-right">
                                        <li><a href="#" class="waves-effect waves-block edit-company" data-company-id="@company.Id" data-toggle="modal" data-target="#CompanyEditModal"><i class="material-icons">edit</i>@L("Edit")</a></li>
                                        <li><a href="#" class="waves-effect waves-block delete-company" data-company-id="@company.Id" data-company-name="@company.Name"><i class="material-icons">delete_sweep</i>@L("Delete")</a></li>
                                    </ul>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
                <button type="button" class="btn btn-primary btn-circle waves-effect waves-circle waves-float pull-right" data-toggle="modal" data-target="#CompanyCreateModal">
                    <i class="material-icons">add</i>
                </button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="CompanyCreateModal" tabindex="-1" role="dialog" aria-labelledby="CompanyCreateModalLabel" data-backdrop="static">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">
                    <span>新增企业</span>
                </h4>
            </div>
            <div class="modal-body">
                <form name="companyCreateForm" role="form" novalidate class="form-validation">
                    <div class="tab-content">
                        <div class="row clearfix" style="margin-top:10px;">
                            <div class="col-sm-12">
                                <div class="form-group form-float">
                                    <div class="form-line">
                                        <input class="form-control" type="text" name="Name" required maxlength="@Company.MaxNameLength" minlength="2">
                                        <label class="form-label">企业名称</label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group form-float">
                                    <div class="form-line">
                                        <input class="form-control" type="text" name="Phone" maxlength="@Company.MaxPhoneLength">
                                        <label class="form-label">企业电话</label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group form-float">
                                    <div class="form-line">
                                        <input class="form-control" type="text" name="Address" maxlength="@Company.MaxAddressLength">
                                        <label class="form-label">企业地址</label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="form-group form-float">
                                    <div class="form-line">
                                        <input class="form-control" type="text" name="Introduction" maxlength="@Company.MaxIntroductionLength">
                                        <label class="form-label">企业简介</label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-sm-12">
                                <div class="checkbox">
                                    <input type="checkbox" name="IsActive" value="true" id="CreateCompanyIsActive" class="filled-in" checked />
                                    <label for="CreateCompanyIsActive">@L("IsActive")</label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default waves-effect" data-dismiss="modal">@L("Cancel")</button>
                        <button type="submit" class="btn btn-primary waves-effect">@L("Save")</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="CompanyEditModal" tabindex="-1" role="dialog" aria-labelledby="CompanyEditModalLabel" data-backdrop="static">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
        </div>
    </div>
</div>